import urlparse

url = 'http://www.baidu.com?a=123456&b=2321'
url = '?a=123123&b=1234'

parsed = urlparse.urlparse(url)

print parsed

print urlparse.parse_qs(parsed.query)
